package cn.cpf.app.util;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;

import java.awt.*;
import java.io.File;
import java.io.IOException;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class OsUtils {

	static void desktopOpen(@NonNull File file) throws IOException {
		Desktop.getDesktop().open(file);
	}

	/**
	 * 打开文件:
	 * <p>
	 *     eg: fileLac = "D:\\CPF_work\\Executable Jar\\LengthwaysTextTranslation.jar";
	 * </p>
	 *
	 * @param fileLac 文件路径
	 */
	static Process exe(final String fileLac) throws IOException {
		return Runtime.getRuntime().exec(fileLac);
	}
}
